import {defineStore} from 'pinia'


export const useStore = defineStore('main', {
    // other options...
   state: ()=>{
    return {
        isCollapse: false,
        tags: [
            {
              path:'/home',
              name:'home',
              label:'首页',
              icon:'home'
            }
          ],
        currentMenu:null,
    }
   },
   actions: {
    increment() {
        this.isCollapse=!this.isCollapse;
      },
    selectMenu(val){
        if(val.name === "home"){
            this.currentMenu = null;
        }else{
            let index = this.tags.findIndex((item)=> item.name === val.name);
            index === -1 ? this.tags.push(val):"";
        }
        console.log(this.tags,'tags');
        
        
    },
   },
   
    
})